//
//  ShmMeasureModel.swift
//  ParsingCC
//
//  Created by ins-yangming on 2023/1/7.
//

import UIKit

// MARK: - 小节信息
class ShmMeasureModel: NSObject {
    
    var number = "0";
    var width = "0";
    
    var print : ShmMeasurePrintModel?;
    
    var attributes : ShmMeasureAttributesModel?;
    
    var notes = [ShmBaseNoteModel]();
    
    
    var directions = [String : ShmNoteDirectionModel]();
    
    
    
    func getXmlElement() -> GDataXMLElement{
        let measureElement = GDataXMLNode.element(withName: "measure");
        if let numberAttribute = GDataXMLNode.attribute(withName: "number", stringValue: self.number) as? GDataXMLNode {
            measureElement?.addAttribute(numberAttribute);
        }
        if let widthAttribute = GDataXMLNode.attribute(withName: "width", stringValue: self.width) as? GDataXMLNode {
            measureElement?.addAttribute(widthAttribute);
        }
        if let printElement = self.print?.getXmlElement() {
            measureElement?.addChild(printElement);
        }
        if let attributesElement = self.attributes?.getXmlElement() {
            measureElement?.addChild(attributesElement);
        }
        for (i , note) in self.notes.enumerated() {
            if let direction = self.directions["\(i)"] {
                measureElement?.addChild(direction.getXmlElement());
            }
            measureElement?.addChild(note.getXmlElement());
        }
        
        return measureElement!;
    }
}

class ShmMeasurePrintModel : NSObject {
    
    var newPage = false;
    
    var systemLayout : ShmMeasureSystemLayoutModel?;
    
    var staffLayout : ShmMeasureStaffLayoutModel?;
    
    func getXmlElement() -> GDataXMLElement{
        let printElement = GDataXMLNode.element(withName: "print");
        if self.newPage {
            if let newPageAttribute = GDataXMLNode.attribute(withName: "new-page", stringValue: "yes") as? GDataXMLNode {
                printElement?.addAttribute(newPageAttribute);
            }
        }
        
        if let systemLayoutElement = self.systemLayout?.getXmlElement() {
            printElement?.addChild(systemLayoutElement);
        }
        if let systemLayoutElement = self.staffLayout?.getXmlElement() {
            printElement?.addChild(systemLayoutElement);
        }
        return printElement!;
    }
}

class ShmMeasureSystemLayoutModel : NSObject {
    
    var systemMargins : [String : String]?;
    
    var topSystemDistance : String?;
    
    
    func getXmlElement() -> GDataXMLElement{
        let systemLayoutElement = GDataXMLNode.element(withName: "system-layout");
        
        if let systemMargins = self.systemMargins {
            let systemMarginsElement = GDataXMLNode.element(withName: "system-margins");
            for (key , value) in systemMargins {
                let element = GDataXMLNode.element(withName: key, stringValue: value);
                systemMarginsElement?.addChild(element);
            }
            systemLayoutElement?.addChild(systemMarginsElement);
        }
        
        if let topSystemDistance = self.topSystemDistance {
            let systemMarginsElement = GDataXMLNode.element(withName: "top-system-distance" , stringValue: topSystemDistance);
            systemLayoutElement?.addChild(systemMarginsElement);
        }
        
        return systemLayoutElement!;
    }
}


class ShmMeasureStaffLayoutModel : NSObject {
    
    var number : String?;
    
    var staffDistance : String?;
    
    
    func getXmlElement() -> GDataXMLElement{
        let staffLayoutElement = GDataXMLNode.element(withName: "staff-layout");
        
        if let number = self.number {
            if let numberAttribute = GDataXMLNode.attribute(withName: "number", stringValue: number) as? GDataXMLNode {
                staffLayoutElement?.addAttribute(numberAttribute);
            }
        }
        
        if let staffDistance = self.staffDistance {
            let staffDistanceElement = GDataXMLNode.element(withName: "top-system-distance" , stringValue: staffDistance);
            staffLayoutElement?.addChild(staffDistanceElement);
        }
//        let xxx = GDataXMLNode.namespace(withName: "1212", stringValue: "1212");
//        staffLayoutElement?.addChild(xxx as! GDataXMLNode)
        
        return staffLayoutElement!;
    }
}

class ShmMeasureAttributesModel : ShmBaseNoteModel {
    
    var divisions : String?;
    var key : ShmMeasureKeyModel?;
    
    var time : ShmMeasureTimesModel?;
    
    var staves : String?;
    
    var clefs = [ShmMeasureClefsModel]();
    
    var staffDetails = [ShmMeasureStaffDetailsModel]();
    
    override func getXmlElement() -> GDataXMLElement{
        let attributesElement = GDataXMLNode.element(withName: "attributes");
        
        if let divisions = self.divisions {
            let divisionsElement = GDataXMLNode.element(withName: "divisions" , stringValue: divisions);
            attributesElement?.addChild(divisionsElement);
        }
        
        if let keyElement = self.key?.getXmlElement() {
            attributesElement?.addChild(keyElement);
        }
        
        if let timeElement = self.time?.getXmlElement() {
            attributesElement?.addChild(timeElement);
        }
        
        if let staves = self.staves {
            let stavesElement = GDataXMLNode.element(withName: "staves" , stringValue: staves);
            attributesElement?.addChild(stavesElement);
        }
        
        for clef in self.clefs {
            attributesElement?.addChild(clef.getXmlElement());
        }
        
        for staffDetail in self.staffDetails {
            attributesElement?.addChild(staffDetail.getXmlElement());
        }

        return attributesElement!;
    }
}


class ShmMeasureKeyModel : NSObject {
    
    var color : String?;
    
    var fifths : String?;
    
    var mode : String?;
    
    func getXmlElement() -> GDataXMLElement{
        let keyElement = GDataXMLNode.element(withName: "key");
        

        if let color = self.color {
            if let colorAttribute = GDataXMLNode.attribute(withName: "color", stringValue: color) as? GDataXMLNode {
                keyElement?.addAttribute(colorAttribute);
            }
        }
        
        if let fifths = self.fifths {
            let fifthsElement = GDataXMLNode.element(withName: "fifths" , stringValue: fifths);
            keyElement?.addChild(fifthsElement);
        }
        
        
        if let mode = self.mode {
            let modeElement = GDataXMLNode.element(withName: "mode" , stringValue: mode);
            keyElement?.addChild(modeElement);
        }
        return keyElement!;
    }
}

class ShmMeasureClefsModel : ShmBaseNoteModel {
    
    var sign : String?;
    
    var line : String?;
    
    var number : String?;
    
    var color : String?;
    
    var clefOctaveChange : Int = 0;
 
    
    override func getXmlElement() -> GDataXMLElement{
        let clefElement = GDataXMLNode.element(withName: "clef");
        
        if let number = self.number {
            if let numberAttribute = GDataXMLNode.attribute(withName: "number", stringValue: number) as? GDataXMLNode {
                clefElement?.addAttribute(numberAttribute);
            }
        }
        
        if let color = self.color {
            if let colorAttribute = GDataXMLNode.attribute(withName: "color", stringValue: color) as? GDataXMLNode {
                clefElement?.addAttribute(colorAttribute);
            }
        }
        
        if let sign = self.sign {
            let signElement = GDataXMLNode.element(withName: "sign" , stringValue: sign);
            clefElement?.addChild(signElement);
        }
        
        
        if let line = self.line {
            let lineElement = GDataXMLNode.element(withName: "line" , stringValue: line);
            clefElement?.addChild(lineElement);
        }
        if self.clefOctaveChange != 0 {
            let lineElement = GDataXMLNode.element(withName: "clef-octave-change" , stringValue: "\(self.clefOctaveChange)");
            clefElement?.addChild(lineElement);
        }
        
        return clefElement!;
    }
}

class ShmMeasureTimesModel : NSObject {
    
    var color : String?;
    
    var beats : String?;
    
    var beatType : String?;
    
    
    func getXmlElement() -> GDataXMLElement{
        let timeElement = GDataXMLNode.element(withName: "time");
        
        if self.beats == "2" && self.beatType == "2" {
            if let colorAttribute = GDataXMLNode.attribute(withName: "symbol", stringValue: "cut") as? GDataXMLNode {
                timeElement?.addAttribute(colorAttribute);
            }
        }
        if let color = self.color {
            if let colorAttribute = GDataXMLNode.attribute(withName: "color", stringValue: color) as? GDataXMLNode {
                timeElement?.addAttribute(colorAttribute);
            }
        }
        
        if let beats = self.beats {
            let beatsElement = GDataXMLNode.element(withName: "beats" , stringValue: beats);
            timeElement?.addChild(beatsElement);
        }
        
        
        if let beatType = self.beatType {
            let beatTypeElement = GDataXMLNode.element(withName: "beat-type" , stringValue: beatType);
            timeElement?.addChild(beatTypeElement);
        }
        return timeElement!;
    }
}



class ShmMeasureStaffDetailsModel : NSObject {
    
    var number : String?;
    
    var printObject : String?;
    
    func getXmlElement() -> GDataXMLElement{
        let staffDetailsElement = GDataXMLNode.element(withName: "staff-details");
        
        if let number = self.number {
            if let numberAttribute = GDataXMLNode.attribute(withName: "number", stringValue: number) as? GDataXMLNode {
                staffDetailsElement?.addAttribute(numberAttribute);
            }
        }
        
        if let printObject = self.printObject {
            if let printObjectAttribute = GDataXMLNode.attribute(withName: "print-object", stringValue: printObject) as? GDataXMLNode {
                staffDetailsElement?.addAttribute(printObjectAttribute);
            }
        }
        
       
        return staffDetailsElement!;
    }
}


class ShmNoteDirectionModel: ShmBaseNoteModel {
    var pedal : String?;
    var isPedalLine = false;
    var voice : String?;
    var staff : String?;
    var placement : String?;
    var segno = false;
    var octaveShift : ShmOctaveShiftModel?;
    var sound : ShmSegnoModel?;
    var words : ShmWordsModel?;
    var offset : ShmOffsetModel?;
    var metronome : ShmMetronomeModel?;
    var dynamics : ShmDynamicsModel?;
    var wedge : ShmWedgeModel?;

   
    override func getXmlElement() -> GDataXMLElement{
        
        let pitchElement = GDataXMLNode.element(withName: "direction");
        
        
        let directionTypeElement = GDataXMLNode.element(withName: "direction-type");
        
        if let placement = self.placement {
            if let placementAttribute = GDataXMLNode.attribute(withName: "placement", stringValue: placement) as? GDataXMLNode {
                directionTypeElement?.addAttribute(placementAttribute);
            }
        }
        
        if let pedal = self.pedal {
            let pedalElement = GDataXMLNode.element(withName: "pedal");
            if let defaultyAttribute = GDataXMLNode.attribute(withName: "default-y", stringValue: "-1") as? GDataXMLNode {
                pedalElement?.addAttribute(defaultyAttribute);
            }
            if let typeAttribute = GDataXMLNode.attribute(withName: "type", stringValue: pedal) as? GDataXMLNode {
                pedalElement?.addAttribute(typeAttribute);
            }
            
            if let lineAttribute = GDataXMLNode.attribute(withName: "line", stringValue: (self.isPedalLine ? "yes" : "no")) as? GDataXMLNode {
                pedalElement?.addAttribute(lineAttribute);
            }
            directionTypeElement?.addChild(pedalElement);
            pitchElement?.addChild(directionTypeElement);
        }
        
        if let octaveShiftTypeElement = self.octaveShift?.getXmlElement() {
            directionTypeElement?.addChild(octaveShiftTypeElement);
            pitchElement?.addChild(directionTypeElement);
        }
        
        if let metronomeElement = self.metronome?.getXmlElement() {
            directionTypeElement?.addChild(metronomeElement);
            pitchElement?.addChild(directionTypeElement);
        }
        
        if let dynamicsElement = self.dynamics?.getXmlElement() {
            directionTypeElement?.addChild(dynamicsElement);
            pitchElement?.addChild(directionTypeElement);
        }
        
        if let wordsElement = self.words?.getXmlElement() {
            directionTypeElement?.addChild(wordsElement);
            pitchElement?.addChild(directionTypeElement);
        }
        if self.segno {
            let segnoElement = GDataXMLNode.element(withName: "segno");
            directionTypeElement?.addChild(segnoElement);
            pitchElement?.addChild(directionTypeElement);
        }
        
        if let wedgeElement = self.wedge?.getXmlElement() {
            directionTypeElement?.addChild(wedgeElement);
            pitchElement?.addChild(directionTypeElement);
        }
        
        if let voice = self.voice {
            let voiceElement = GDataXMLNode.element(withName: "voice" , stringValue: voice);
            pitchElement?.addChild(voiceElement);
        }
        
        
        let staffElement = GDataXMLNode.element(withName: "staff" , stringValue: self.staff);
        pitchElement?.addChild(staffElement);
       
        
        if let soundElement = self.sound?.getXmlElement() {
            pitchElement?.addChild(soundElement);
        }
        
        return pitchElement!;
    }
    
    
}

class ShmWedgeModel : NSObject {
    var type = "";
    
    var number = "";
    
    func getXmlElement() -> GDataXMLElement{
       
        let wedgeElement = GDataXMLNode.element(withName: "wedge");
        
     
        if let defaultyAttribute = GDataXMLNode.attribute(withName: "default-y", stringValue: "-65") as? GDataXMLNode {
            wedgeElement?.addAttribute(defaultyAttribute);
        }
        
        if let numberAttribute = GDataXMLNode.attribute(withName: "number", stringValue: self.number) as? GDataXMLNode {
            wedgeElement?.addAttribute(numberAttribute);
        }
        
        if let typeAttribute = GDataXMLNode.attribute(withName: "type", stringValue: self.type) as? GDataXMLNode {
            wedgeElement?.addAttribute(typeAttribute);
        }
        
        return wedgeElement!;
    }
    
}

class ShmMetronomeModel : NSObject {
    var perMinute = "";
    
    func getXmlElement() -> GDataXMLElement{
        
        let metronomeElement = GDataXMLNode.element(withName: "metronome");
        
        if let defaultyAttribute = GDataXMLNode.attribute(withName: "default-y", stringValue: "65") as? GDataXMLNode {
            metronomeElement?.addAttribute(defaultyAttribute);
        }
        
        if let colorAttribute = GDataXMLNode.attribute(withName: "color", stringValue: "#000000") as? GDataXMLNode {
            metronomeElement?.addAttribute(colorAttribute);
        }
        
        if let familyAttribute = GDataXMLNode.attribute(withName: "font-family", stringValue: "Opus Text Std") as? GDataXMLNode {
            metronomeElement?.addAttribute(familyAttribute);
        }
        
        if let styleAttribute = GDataXMLNode.attribute(withName: "font-style", stringValue: "normal") as? GDataXMLNode {
            metronomeElement?.addAttribute(styleAttribute);
        }
        
        if let sizeAttribute = GDataXMLNode.attribute(withName: "font-size", stringValue: "normal") as? GDataXMLNode {
            metronomeElement?.addAttribute(sizeAttribute);
        }
        
        if let sizeAttribute = GDataXMLNode.attribute(withName: "weight", stringValue: "normal") as? GDataXMLNode {
            metronomeElement?.addAttribute(sizeAttribute);
        }
        
        
        let beatUnitElement = GDataXMLNode.element(withName: "beat-unit" , stringValue: "quarter");
        metronomeElement?.addChild(beatUnitElement);
        
        let perMinuteElement = GDataXMLNode.element(withName: "per-minute" , stringValue: self.perMinute);
        metronomeElement?.addChild(perMinuteElement);
       
        
        return metronomeElement!;
    }
    
}

class ShmDynamicsModel : NSObject{
    var dynamics = "";
   
    func getXmlElement() -> GDataXMLElement{
        
        let dynamicsElement = GDataXMLNode.element(withName: "dynamics");
        
        if let defaultxAttribute = GDataXMLNode.attribute(withName: "default-y", stringValue: "-1") as? GDataXMLNode {
            dynamicsElement?.addAttribute(defaultxAttribute);
        }
        
        if let defaultyAttribute = GDataXMLNode.attribute(withName: "default-y", stringValue: "65") as? GDataXMLNode {
            dynamicsElement?.addAttribute(defaultyAttribute);
        }
        
        if let colorAttribute = GDataXMLNode.attribute(withName: "color", stringValue: "#000000") as? GDataXMLNode {
            dynamicsElement?.addAttribute(colorAttribute);
        }
        
        if let familyAttribute = GDataXMLNode.attribute(withName: "font-family", stringValue: "Opus Text Std") as? GDataXMLNode {
            dynamicsElement?.addAttribute(familyAttribute);
        }
        
        if let styleAttribute = GDataXMLNode.attribute(withName: "font-style", stringValue: "normal") as? GDataXMLNode {
            dynamicsElement?.addAttribute(styleAttribute);
        }
        
        if let sizeAttribute = GDataXMLNode.attribute(withName: "font-size", stringValue: "11.9365") as? GDataXMLNode {
            dynamicsElement?.addAttribute(sizeAttribute);
        }
        
        if let weightAttribute = GDataXMLNode.attribute(withName: "font-weight", stringValue: "normal") as? GDataXMLNode {
            dynamicsElement?.addAttribute(weightAttribute);
        }
        
        let valueElement = GDataXMLNode.element(withName: self.dynamics);
        dynamicsElement?.addChild(valueElement);
       
       
        return dynamicsElement!;
    }
    
}

class ShmWordsModel : NSObject {
    var defaultY = "28";
    var justify = "left";
    var valign = "middle";
    var fontFamily = "SimHei";
    var fontStyle = "normal";
    var fontSize = "13.0217";
    var fontWeight = "bold";
    var text = "CODA";
    
    func getXmlElement() -> GDataXMLElement {
        
        let wordsElement = GDataXMLNode.element(withName: "words" , stringValue: self.text);
        
        if let defaultYAttribute = GDataXMLNode.attribute(withName: "default-y", stringValue: self.defaultY) as? GDataXMLNode {
            wordsElement?.addAttribute(defaultYAttribute);
        }
        
        if let justifyAttribute = GDataXMLNode.attribute(withName: "justify", stringValue: self.justify) as? GDataXMLNode {
            wordsElement?.addAttribute(justifyAttribute);
        }
        
        if let valignAttribute = GDataXMLNode.attribute(withName: "valign", stringValue: self.valign) as? GDataXMLNode {
            wordsElement?.addAttribute(valignAttribute);
        }
        
        if let fontFamilyAttribute = GDataXMLNode.attribute(withName: "fontFamily", stringValue: self.fontFamily) as? GDataXMLNode {
            wordsElement?.addAttribute(fontFamilyAttribute);
        }
       
        
        if let fontstyleAttribute = GDataXMLNode.attribute(withName: "font-style", stringValue: self.fontStyle) as? GDataXMLNode {
            wordsElement?.addAttribute(fontstyleAttribute);
        }
        
        if let fontSizeAttribute = GDataXMLNode.attribute(withName: "font-size", stringValue: self.fontSize) as? GDataXMLNode {
            wordsElement?.addAttribute(fontSizeAttribute);
        }
        
        if let fontweightAttribute = GDataXMLNode.attribute(withName: "font-weight", stringValue: self.fontWeight) as? GDataXMLNode {
            wordsElement?.addAttribute(fontweightAttribute);
        }
        
        
        
        return wordsElement!;
    }
    
}

class ShmOffsetModel : ShmBaseNoteModel {
    var sound : String?;
    var value = "";
    
    override func getXmlElement() -> GDataXMLElement {
        let offsetElement = GDataXMLNode.element(withName: "offset" , stringValue: self.value);
        
        if let sound = self.sound {
            if let soundAttribute = GDataXMLNode.attribute(withName: "sound", stringValue: sound) as? GDataXMLNode {
                offsetElement?.addAttribute(soundAttribute);
            }
        }
        
        return offsetElement!;
    }
}


class ShmOctaveShiftModel : ShmBaseNoteModel {
    var type = "";
    var size = "";
    var number = "";
    var isUp = false;
    var shiftSize = 0;
    
    override func getXmlElement() -> GDataXMLElement {
        let octaveshiftElement = GDataXMLNode.element(withName: "octave-shift");
        
        if let xAttribute = GDataXMLNode.attribute(withName: "default-x", stringValue: "-1") as? GDataXMLNode {
            octaveshiftElement?.addAttribute(xAttribute);
        }
        
        if let yAttribute = GDataXMLNode.attribute(withName: "default-y", stringValue: "40") as? GDataXMLNode {
            octaveshiftElement?.addAttribute(yAttribute);
        }
        
        if let fontstyleAttribute = GDataXMLNode.attribute(withName: "font-style", stringValue: "normal") as? GDataXMLNode {
            octaveshiftElement?.addAttribute(fontstyleAttribute);
        }
        
        if let fontweightAttribute = GDataXMLNode.attribute(withName: "font-weight", stringValue: "normal") as? GDataXMLNode {
            octaveshiftElement?.addAttribute(fontweightAttribute);
        }
        
        if let colorAttribute = GDataXMLNode.attribute(withName: "color", stringValue: "#000000") as? GDataXMLNode {
            octaveshiftElement?.addAttribute(colorAttribute);
        }
        
        
        if let typeAttribute = GDataXMLNode.attribute(withName: "type", stringValue: self.type) as? GDataXMLNode {
            octaveshiftElement?.addAttribute(typeAttribute);
        }
        
        
        if let sizeAttribute = GDataXMLNode.attribute(withName: "size", stringValue: self.size) as? GDataXMLNode {
            octaveshiftElement?.addAttribute(sizeAttribute);
        }
        
        
        if let numberAttribute = GDataXMLNode.attribute(withName: "number", stringValue: self.number) as? GDataXMLNode {
            octaveshiftElement?.addAttribute(numberAttribute);
        }
        
        return octaveshiftElement!;
    }
    
}

class ShmBarlineModel : ShmBaseNoteModel {

    
    var location = "";
    
    var barStyle = "";
    
    var direction = "";
    
    var endingNumber = "";
    
    var endingType = "";
    
    
    override func getXmlElement() -> GDataXMLElement {
        let barlineElement = GDataXMLNode.element(withName: "barline");
        
        if let locationAttribute = GDataXMLNode.attribute(withName: "location", stringValue: self.location) as? GDataXMLNode {
            barlineElement?.addAttribute(locationAttribute);
        }
        
        if self.barStyle.count != 0 {
            let barStyleElement = GDataXMLNode.element(withName: "bar-style" , stringValue: self.barStyle);
            barlineElement?.addChild(barStyleElement);
        }
        
        if self.direction.count != 0 {
            let repeatElement = GDataXMLNode.element(withName: "repeat");
            if let directionAttribute = GDataXMLNode.attribute(withName: "direction", stringValue: self.direction) as? GDataXMLNode {
                repeatElement?.addAttribute(directionAttribute);
            }
            barlineElement?.addChild(repeatElement);
        }
        
        
        if self.endingType.count != 0 {
            let endingElement = GDataXMLNode.element(withName: "ending");
            if let numberAttribute = GDataXMLNode.attribute(withName: "number", stringValue: self.endingNumber) as? GDataXMLNode {
                endingElement?.addAttribute(numberAttribute);
            }
            if let numberAttribute = GDataXMLNode.attribute(withName: "type", stringValue: self.endingType) as? GDataXMLNode {
                endingElement?.addAttribute(numberAttribute);
            }
            barlineElement?.addChild(endingElement);
        }
        
        return barlineElement!;
    }
    
}



class ShmSegnoModel : ShmBaseNoteModel {
    var tocoda : String?;
    var timeOnly : String?;
    var dalsegno : String?;
    var segno : String?;
    
    var offset = "";
   
    override func getXmlElement() -> GDataXMLElement {
        let soundElement = GDataXMLNode.element(withName: "sound");
        
        if let tocoda = self.tocoda {
            if let tocodaAttribute = GDataXMLNode.attribute(withName: "tocoda", stringValue: tocoda) as? GDataXMLNode {
                soundElement?.addAttribute(tocodaAttribute);
            }
        }
        
        if let timeOnly = self.timeOnly {
            if let timeOnlyAttribute = GDataXMLNode.attribute(withName: "time-only", stringValue: timeOnly) as? GDataXMLNode {
                soundElement?.addAttribute(timeOnlyAttribute);
            }
        }
        if let dalsegno = self.dalsegno {
            if let dalsegnoAttribute = GDataXMLNode.attribute(withName: "dalsegno", stringValue: dalsegno) as? GDataXMLNode {
                soundElement?.addAttribute(dalsegnoAttribute);
            }
        }
        
        if let segno = self.segno {
            if let segnoAttribute = GDataXMLNode.attribute(withName: "segno", stringValue: segno) as? GDataXMLNode {
                soundElement?.addAttribute(segnoAttribute);
            }
        }
        
       
        
        let offsetElement = GDataXMLNode.element(withName: "offset" , stringValue: self.offset);
        soundElement?.addChild(offsetElement);
       
        return soundElement!;
    }
    
}
